#include<bits/stdc++.h>

using namespace std;

int main() {
    int n;
    int tot = 0;
    int A[1000], i = 0;

    for (n = 123; n <= 432; n++) {
        int a = n / 100;
        if (a < 1 || a > 4)continue;
        int b = n / 10 % 10;
        if (a == b || b < 1 || b > 4)continue;
        int c = n % 10;
        if (c == a || c == b || c < 1 || c > 4)continue;

        A[i++] = n;
        ++tot;
    }
    cout << tot << endl;
    for (int j = 0; j < i; j++) {
        cout << " " << A[j];
    }
    return 0;
}
